unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, RzButton, ExtCtrls, RzPanel;

type
  TForm1=class(TForm)
    Tool_1: TRzToolbar;
    Btnx_View: TRzToolButton;
    Btnx_1: TRzToolButton;
    procedure Btnx_ViewClick(Sender: TObject);
    procedure Btnx_1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses
  NativeXmlOld,NativeXml;

{$R *.dfm}

procedure TForm1.Btnx_ViewClick(Sender: TObject);
var
  OD  :TOpenDialog;
  XMLA:TNativeXmlOld;
begin
  try
    OD:=TOpenDialog.Create(nil);
    if OD.Execute then
    begin
      XMLA:=TNativeXmlOld.Create;
      XMLA.LoadFromFile(OD.FileName);
      XMLA.EncodingString:='gb2312';
      XMLA.XmlFormat:=xfoReadable;
      XMLA.SaveToFile(OD.FileName);
    end;
  finally
    FreeAndNil(OD);
  end;
end;

procedure TForm1.Btnx_1Click(Sender: TObject);
var
  OD  :TOpenDialog;
  XMLA:TNativeXML;
begin
  try
    OD:=TOpenDialog.Create(nil);
    if OD.Execute then
    begin
      XMLA:=TNativeXml.Create(nil);
      XMLA.LoadFromFile(OD.FileName);
      XMLA.ExternalEncoding:=seUTF8;
      XMLA.XmlFormat:=xfReadable;
      XMLA.SaveToFile(OD.FileName);
    end;
  finally
    FreeAndNil(OD);
  end;
end;

end.
